package com.xuesi.demoadmin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xuesi.demoadmin.entity.User;
import com.xuesi.demoadmin.service.IAuthService;
import com.xuesi.demoadmin.entity.LoginBody;
import com.xuesi.demoadmin.entity.R;

@RestController
@RequestMapping("/api/auth")
public class AuthController {
    @Autowired
    private IAuthService authService;

    @PostMapping("/login")
    public R<User> login(@Validated LoginBody loginBody) {
        return this.authService.login(loginBody.getPhone(), loginBody.getPassword());
    }
}
